<?php

namespace app\validate;

use share\validate\SceneValidate;

class AppInfoTableValidate extends SceneValidate{
    protected $rule = [      
        'state' => 'require|min:16',
        'encode' => 'require|min:30',
        'code' => 'require|alphaNum|max:8',
        'hash' => 'require|alphaNum|max:120',    
        'scene' => 'require|max:100', 
        'package' =>  'require|max:100', 
        'language' =>  'require|max:10', 
        'id' => 'require',
      
        'vendor' => 'require',
        'vendorName' => 'require',
        'android' => 'require|integer',
        'ios' => 'require|integer',
        'companyEn' => 'require',
        'companyCn' => 'require',
        'appEn' => 'require',
        'appCn' => 'require',
        'contactPersonCn' => 'require',
        'contactPersonEn' => 'require',
        'addressCn' => 'require',
        'addressEn' => 'require',
        'phone' => 'require',
        'downloadGoogle' => 'require',
        'downloadIos' => 'require',
        'downloadTencet' => 'require',
        'appIds' => 'require|array',
        'mids' => 'require|array',
    ];  
    
    protected $sceneRules = [
        'list' => [
            'vendor' => 'length:1,60',
            'package'  => 'length:1,120',
        ],
        'edit' => [
            'id' => 'require',
            'package'=> 'length:1,120',
            'vendor' => 'length:2,30',
            'vendorName'=> 'length:2,120',
            'android' => 'integer',
            'ios' => 'integer',
            'companyEn'=> 'length:1,250',
            'companyCn'=> 'length:1,250',
            'appEn'=> 'length:1,250',
            'appCn'=> 'length:1,250',
            'contactPersonCn'=> 'length:1,250',
            'contactPersonEn'=> 'length:1,250',
            'addressCn'=> 'length:1,250',
            'addressEn'=> 'length:1,250',
            'phone' => 'length:7,20',
            'downloadGoogle'=> 'length:1,250',
            'downloadIos'=> 'length:1,250',
            'downloadTencet' => 'length:1,250',
        ],
        'setClientMch' => [
            'id' => 'require',
            'appIds' => 'array',
            'mids' => 'array',
        ],
    ];

    protected $scene = [
        'apply' => ['state', 'encode', 'code', 'token','scene'],
        'privacy' => ['package', 'language'],
        'userAgreement' => ['package', 'language'],
        'add' => ['package','vendor','vendorName','android','ios','companyEn','companyCn','appEn','appCn','contactPersonCn','contactPersonEn','addressCn','addressEn','phone','downloadGoogle','downloadIos','downloadTencet'],
        'edit' => ['id','package','vendor','vendorName','android','ios','companyEn','companyCn','appEn','appCn','contactPersonCn','contactPersonEn','addressCn','addressEn','phone','downloadGoogle','downloadIos','downloadTencet'],
        'del' => ['id'],
        'list' => ['vendor','package'],
        'getClientMch' => ['id'],
        'setClientMch' => ['id','appIds','mids'],
    ];
}